<extend name="Base:base" />
<block name="base_main">
	<link rel="stylesheet" href="__PUBLIC__/seller/css/validform.css" />
	<script src="__PUBLIC__/seller/js/Validform_v5.3.2.js"></script>
	<style>
		body{ background:#fff }
	</style>
	<div class="tpl-block ">
		<div class="am-g tpl-amazeui-form">
			<div class="am-u-sm-12 am-u-md-9">
				<form class="am-form am-form-horizontal" request_type="parent" action="" name="myfromSubmit" method="post">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">手机号</label>
						<div class="am-u-sm-9">
							<?php echo preg_replace('/^([0-9]{3})([0-9]{4})([0-9]{4})$/','$1****$3' , $login_info['contact_tel']); ?>	
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-email" class="am-u-sm-3 am-form-label">验证码</label>
						<div class="am-u-sm-3 float_left">
							<input type="text" datatype="*" value="" name="orgin_code" placeholder="验证码">
						</div>
						<div class="am-u-sm-4 float_left">
							<button class="am-btn am-btn-default" type="button" data-type="orgin" id="get_checked">
									获得验证码
							</button>
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-QQ" class="am-u-sm-3 am-form-label">新手机号</label>
						<div class="am-u-sm-9">
							<span><input type="text" datatype="*" name="mobile" id="mobile" value="" placeholder="新手机号"></span>
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-email" class="am-u-sm-3 am-form-label">验证码</label>
						<div class="am-u-sm-3 float_left">
							<input type="text" datatype="*" value="" name="new_code" placeholder="验证码">
						</div>
						<div class="am-u-sm-4 float_left">
							<button class="am-btn am-btn-default" type="button" data-type="new" id="get_checked">
									获得验证码
							</button>
						</div>
					</div>

					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<button type="submit" class="am-btn am-btn-primary">确认修改</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script>
		obj_position = 'parent';
		call_submit_back_flag = true;
		function call_submit_back_func() {
			parent.localhost.reload();
		}
		$('button#get_checked').click(function(){
				var _self = $(this);
				if(  _self.attr('data-type') == 'orgin' ) {
						var url = '{:U('Accunt/orginMobileCheck')}';
				} else {
						var mobile = $('#mobile').val();
						if( mobile == '' ) {
								error('手机号不能为空！');
								return false;
						}
						var url = '{:U('Accunt/newMobileCheck')}?mobile=' + mobile;
				}
				$.get( url , function( data ){
					if( data.status == 1 ) {
							success( '短信验证码发送成功' );
							var times = 30;
							_self.attr('disabled' , true);
							var timeIndex = setInterval(function(){
									if( times <= 0 ) {
										_self.text( '重新发送' ).attr('disabled' , false);
										clearInterval( timeIndex );
									} else {
										_self.text( times + ' s');
										times--;
									}
							}, 1000);
					} else {
							error( data.msg );	
					}
				} , 'json');
		});
	</script>
</block>